define(['vue','common'],function (Vue,common){
    const {createApp} = Vue;
    let Controller = {
        index:function (){
            let app = createApp({
                data(){
                    return {
                        //列表数据
                        listObj:{
                            page:1,
                            limit:10,
                            total:0,
                            list:[]
                        },
                        //搜索条件
                        search:{
                            list:[],
                            form:{
                                filter:[],
                                op:[],
                                pk:"id",
                                sort:'id',
                                order:"asc"
                            }
                        },
                        //批量选择
                        selectables:[]
                    }
                },
                created(){
                    this.getList()
                },
                methods:{
                    ...common,
                    selectable(row){
                        return row.id!=1
                    }
                }
            })
            common.load(app,['icon'])
            app.mount('#app')
        },
        add:function (){
            let app = createApp({
                data(){
                    return {
                        form:{
                            username:"",
                            nickname:"",
                            password:"",
                            avatar:"",
                            email:"",
                            status:1,
                            group_ids:[]
                        },
                        rules:{
                            username:[
                                { required: true, message: '请输入用户名', trigger: 'blur' }
                            ],
                            password: [
                                { required: true, message: '请输入密码', trigger: 'blur' }
                            ],
                        },
                        options:{
                            groupList:[]
                        }
                    }
                },
                created(){
                    this.options.groupList = Config.groupList
                    // console.log(this.options,'tttttttttttttttt')
                },
                methods:{
                    ...common
                }
            })
            common.load(app,['icon','MuTreeSelect','MuAvatarUpload'])
            app.mount('#app')
        },
        edit:function (){
            let app = createApp({
                data(){
                    return {
                        form:{
                            // username:"",
                            nickname:"",
                            password:"",
                            avatar:"",
                            email:"",
                            status:1,
                            group_ids:[]
                        },
                        rules:{
                            username:[
                                { required: true, message: '请输入用户名', trigger: 'blur' }
                            ]
                        },
                        options:{
                            groupList:[]
                        }
                    }
                },
                created(){
                    this.options.groupList = Config.groupList
                    this.form = common.addObject(this.form,Config.row)
                    console.log(this.form,'tttttttttttttttt')
                },
                methods:{
                    ...common
                }
            })
            common.load(app,['icon','MuTreeSelect','MuAvatarUpload'])
            app.mount('#app')
        }
    }
    return Controller;
})